Show th plot
library(plotly)
## Warning: package 'plotly' was built under R version 3.4.2
## Loading required package: ggplot2
##
## Attaching package: 'plotly'
## The following object is masked from 'package:ggplot2':
##
## last_plot
## The following object is masked from 'package:stats':
##
## filter
## The following object is masked from 'package:graphics':
##
## layout
library(ggplot2)
library(ggmap)
## Warning: package 'ggmap' was built under R version 3.4.2
##
## Attaching package: 'ggmap'
## The following object is masked from 'package:plotly':
##
## wind
withLocation<- read.csv("countries.csv", header = T)
withLocation
## countries lon lat
## 1 NA NA
## 2 Ghana -1.023194 7.946527
## 3 Guinea -9.696645 9.945587
## 4 Mali -3.996166 17.570692
## 5 Niger 8.081666 17.607790
## 6 India 78.962880 20.593684
## 7 Iran 53.688046 32.427910
## 8 Iraq 43.679291 33.223191
## 9 Japan 138.252924 36.204824
## 10 Korea DPR 127.510093 40.339852
## 11 England -1.174320 52.355518
## 12 France 2.213749 46.227638
## 13 Germany 10.451526 51.165691
## 14 Spain -3.749220 40.463667
## 15 Turkey 35.243322 38.963745
## 16 Costa Rica -83.753428 9.748910
## 17 Honduras -86.241905 15.199999
## 18 Mexico -102.552784 23.634501
## 19 USA -95.712891 37.090240
## 20 New Caledonia 165.618042 -20.904305
## 21 New Zealand 174.885971 -40.900557
## 22 Brazil -51.925280 -14.235004
## 23 Chile -71.542969 -35.675147
## 24 Colombia -74.297333 4.570868
## 25 Paraguay -58.443832 -23.442503
x <- withLocation$lon
y <- withLocation$lat
country <- withLocation$countries
world <- borders("world", colour="grey", fill="lightblue")
q<-ggplot() + world + geom_point(aes(x=x, y=y,
label = country),color="red", size=3 )
## Warning: Ignoring unknown aesthetics: label
ggplotly(q)
## We recommend that you use the dev version of ggplot2 with `ggplotly()`
## Install it with: `devtools::install_github('hadley/ggplot2')`